package com.yy.wga.admin.service.controller;

import com.yy.wga.mp.common.aop.NotLogin;
import com.yy.wga.mp.module.admin.request.AdminUserBasePageRequest;
import com.yy.wga.mp.module.admin.request.AdminUserBaseUpdateStatusRequest;
import com.yy.wga.mp.module.admin.response.AdminUserBasePageResponse;
import com.yy.wga.mp.module.user.manager.UserManager;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 运营后台/小程序用户信息接口
 *
 * @author guochao
 * @since 2022-11-01 19:08:37
 */
@RestController
@RequestMapping("/admin/userBase")
public class AdminUserBaseController {
    /**
     * 服务对象
     */
    @Resource
    private UserManager userManager;

    @NotLogin
    @PostMapping(value = "/page")
    public Result<PageBean<AdminUserBasePageResponse>> page(@RequestBody @Valid AdminUserBasePageRequest request) {
        PageBean<AdminUserBasePageResponse> pageBean = userManager.page(request);
        return Result.success(pageBean);
    }

    @PostMapping(value = "/updateStatus")
    public Result<Boolean> updateStatus(@RequestBody @Valid AdminUserBaseUpdateStatusRequest request) {
        userManager.updateStatus(request);
        return Result.success(Boolean.TRUE);
    }
}
